var express = require('express');
var router = express.Router();
var util = require('./util.js');

var wtfs = [];

router.route('/waterfall')
	.get(function(req, res) {
		res.render("other/waterfall", {
			sub_title: "Waterfall",
			wtfs: waterfall()
		})
	})

	.post(function(req, res) {
		res.send(waterfall());
	});

var waterfall = function() {
	if(wtfs == undefined || wtfs.length == 0) {
		wtfs = util.initImgArray('/public/img/waterfall/');
	}
	return wtfs;
}
module.exports = router;